package com.test.web;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.test.model.EbComment;
import com.test.service.EbCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/comment")
public class EbCommentController {
    @Autowired
     private EbCommentService ebCommentService;
    @RequestMapping("/list")
    public String list(Model model,
                        @RequestParam(defaultValue = "1") int psize,
                       @RequestParam(defaultValue = "8") int pageSize){
        //1.调用Service查询留言数据
        Page<EbComment> commentPage =ebCommentService.list(psize,pageSize);
        //2.绑定数据到model--数据
        model.addAttribute("cpage",commentPage);
        //3.返回视图view--html
        return "guestbook";
    }
}
